home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 2: CDPD 1
/
Almathera Ten on Ten - Disc 2: CDPD 1.iso
/
pd
/
076-100
/
084
/
ed
/
esc.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-13
|
719b
|
42 lines
#include <stdio.h>
#include "tools.h"
/* Map escape sequences into their equivalent symbols. Returns the
* correct ASCII character. If no escape prefix is present then s
* is untouched and *s is returned, otherwise **s is advanced to point
* at the escaped character and the translated character is returned.
*/
esc(s)
char **s;
{
register int rval;
if (**s != ESCAPE)
{
rval = **s;
} else {
(*s)++;
switch(toupper(**s))
{
case '\000':
rval = ESCAPE; break;
case 'S':
rval = ' '; break;
case 'N':
rval = '\n'; break;
case 'T':
rval = '\t'; break;
case 'B':
rval = '\b'; break;
case 'R':
rval = '\r'; break;
default:
rval = **s; break;
}
}
return (rval);
}